package 笔试做题;

import java.text.DecimalFormat;
import java.util.ArrayList;
import java.util.List;
import java.util.Scanner;

public class 输入输出练习 {


    public static void main(String[] args) {
        Scanner sc = new Scanner(System.in);
        while(sc.hasNext()){
            String temp1 = sc.nextLine();
            String[] temp1Array = temp1.split(" ");
            // 就Integer.parseInt(), String.valueOf()这种方法来做数值和String的转换
            // Double等也有同样的方法
            int aInt = Integer.parseInt(temp1Array[0]);
            System.out.println(aInt);
            String intString = String.valueOf(aInt);
            System.out.println(intString);
            double aDouble = Double.parseDouble(temp1Array[1]);
            String doubleString = String.valueOf(aDouble);
            // 输入是double
            DecimalFormat decimalFormat = new DecimalFormat("0.000");
            System.out.println(decimalFormat.format(aDouble));// 注意这里返回值本身就是个String
            System.out.println(Double.parseDouble(decimalFormat.format(aDouble)));// 这样就真的转成了修改精确度的double
            System.out.printf("%.3f", aDouble);// printf输出后面是什么都不带的, 要接别的东西就在之后print
        }

    }


    public List<List<Integer>> readInput(){
        Scanner sc = new Scanner(System.in);
        List<List<Integer>> res = new ArrayList<>();
        while(sc.hasNext()){
            String line = sc.nextLine();
            String[] lineArray = line.split(" ");
            List<Integer> resEle = new ArrayList<>();
            for(int i = 0; i < lineArray.length; i++){
                resEle.add(Integer.parseInt(lineArray[i]));
            }
            res.add(resEle);
        }
        sc.close();
        return res;
    }




}
